/*
 * @Author: szx
 * @Date: 2022-05-27 14:08:24
 * @LastEditTime: 2022-05-27 14:14:25
 * @Description:
 * @FilePath: \leetcode\面试题\16\02\02.js
 */
/**
 * @param {string[]} book
 */
var WordsFrequency = function (book) {
    const map = new Map();
    for (let b of book) map.set(b, (map.get(b) || 0) + 1);
    this.map = map;
};

/**
 * @param {string} word
 * @return {number}
 */
WordsFrequency.prototype.get = function (word) {
    return this.map.get(word) ?? 0;
};

/**
 * Your WordsFrequency object will be instantiated and called as such:
 * var obj = new WordsFrequency(book)
 * var param_1 = obj.get(word)
 */
